import { lazyReportBatch } from "../report";
export default function onClick() {
  ["mousedown", "touchstart"].forEach((type) => {
    window.addEventListener(type, (e) => {
      const target = e.target;
      console.log("target", target);

      if (target.tagName) {
        const reportData = {
          type: "behavior",
          subType: "click",
          eventType: type,
          target: target.tagName,
          path: e.path,
          startTime: e.timeStamp,
          innerHtml: target.innerHtml,
          outerHtml: target.outerHtml,
          width: target.offsetWidth,
          height: target.offsetHeight,
        };
        lazyReportBatch(reportData);
      }
    });
  });
}
